package com.olap.starter.common.vo;

import lombok.Data;

import java.util.List;
import java.util.Map;

@Data
public class QueryParameter {
    private Long id;
    private List<Parameter> queryParameterListAnd; //and
    private List<Parameter> queryParameterListOr;//or
    private Map<String, Object> queryParameterMapIn;//key作为in  value做为值   key in (value)
    private Map<String, Object> queryParameterMap;//where条件参数
    private int pageNumber = 1;//页数
    private int pageSize = 10; //每页数量
    private boolean enablePage = true; //是否启用分页
    boolean humpToLine = false;//是否驼峰转换 默认开启
    private List<String> orderBy; //排序
    private List<String> notHumpToLine;//不转换驼峰字段
    private List<String> groupBy; //分组
    private String sql;
    private String executeSql;
    private String theme;
    private String executeWhere;
    private String orderByStr;
    private String dbName;;
    private int queryType = 0;//0是table 1是树
    private String dbType;//数据库类型
    private String tableName;//数据表名
    private AuthVo authVo;//权限vo

    private String authSql;

    public Object getQueryParameterListAndByKeyValue(String key) {
        for (Parameter parameter : queryParameterListAnd) {
            if(key.equals(parameter.getKey())){
                return parameter.getValue();
            }
        }
        return null;
    }
}
